from time import sleep
from selenium.webdriver.common.by import By
from base.base import Base

class SouSuoPage(Base):

    shoucangtubiao =(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.drawerlayout.widget.DrawerLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TabHost/android.widget.LinearLayout/android.widget.TabWidget/android.widget.RelativeLayout[3]/android.widget.LinearLayout/android.widget.ImageView')

    sousuokuang = (By.ID,'com.xiachufang:id/search_edit_text')

    sousuoshurukuang = (By.XPATH,'//android.widget.EditText([resourceId.com.xiachufang:id/search_edit_text])')

    sousuowenzi = 'new UiSelector().text("搜索")'

    dy1 = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.TextView[1]')

    dy2 = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup[2]/android.widget.TextView[1]')

    dy3 = (By.XPATH, '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.RelativeLayout/android.widget.TextView[1]')


    def sousuoyewu(self,contents):
        self.loc_ele(self.shoucangtubiao).click()
        sleep(4)
        self.loc_ele(self.sousuokuang).click()
        sleep(4)
        self.loc_ele(self.sousuoshurukuang).send_keys(contents)
        sleep(4)
        self.loc_ui_ele(self.sousuowenzi).click()
        sleep(4)